package fr.cephb.joperon.core.entities;
import com.sleepycat.db.DatabaseEntry;
import com.sleepycat.db.DatabaseException;

import fr.cephb.joperon.core.bio.AcidNucleicUtil;
import fr.cephb.joperon.core.entities.base.BaseXPanel;


/**
 * XPanel
 * Description: Genotype counts
 */
public class XPanel
	extends BaseXPanel
	{
	/**
     *
     * Constructor
     *
     */
	public XPanel()
		{
		super();
		}


        /**
         *
         * Copy Constructor
         *
         */
		public XPanel(BaseXPanel cp)
			{
			super(cp);
			}
		
		/**
		 * constructor from a database entry
		 *
		 */
		public XPanel(DatabaseEntry entry) throws DatabaseException
			{
			super(entry);
			}
		
		/** return a double value for frequence between 0 and 1.0 */
		public double getFrequence()
			{
			return ((double)super.getFreq())/100.0;
			}
		
		/** return the two alleles for this xpanel */
		public char[] getAlleles()
			{
			String s= AcidNucleicUtil.decode_genotype(getCode());
			return new char[]{s.charAt(0), s.charAt(1)};
			}
		
        /**
         *
         * clone
         *
         */
		public Object clone()
			{
			return new XPanel(this);
			}

		}

